//Regressions using annual data

clear all
set more off
qui use GU82_18_A_j_all, replace
qui tsset idj year, yearly

keep if j_ft==int(j_ft)
qui tab j_ft, gen(ft_)
keep if j_union==int(j_union)
qui tab j_union, gen(union_)
keep if j_ownership==int(j_ownership)
qui tab j_ownership, gen(own_)

foreach a of varlist size_* femog_* n1_* rg_* ft_* union_* own_* {
qui gen gdp`a'=`a'*logrgdpdiff
}

drop if missing(logdiffj_ahr) | missing(logdiffj_cqtotben) | missing(logdiffj_comp)
qui tsset idj year, yearly 
sort idj year
qui egen wtcon=mean(j_estoccwt), by (idj)

//============================================================================
qui gen dp7=0
qui replace dp7=1 if year>2007
foreach a of varlist logrgdpdiff urdiff {
qui gen dp7`a'=`a'*dp7
}

//Table 1
*Hourly, real growth, with controls; weighted, n2, full sample; dum07 
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

*Annually, real growth, with controls; weighted, n2, full sample; dum07 
foreach a of varlist aj_ahr aj_cqtotben aj_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 2
*Hourly, UR, with controls; weighted, n2, full sample; dum07 
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' urdiff year dp7urdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dp7urdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.2: subsamples
foreach a of varlist j_ahr j_cqtotben j_comp { 
//pre08
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post07
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.3: add post07 trend
foreach a of varlist year{
qui gen dp7`a'=`a'*dp7
}

foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7year dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7year dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.4: alternative cycle indicators
//HP RGDP
foreach a of varlist hplogrgdp {
qui gen dp7`a'=`a'*dp7
}
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' hplogrgdp year dp7hplogrgdp dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' hplogrgdp year dp7hplogrgdp dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.4: alternative cycle indicators
//NBER contraction
sort year
save masterfile, replace

qui use NBERdating_2018, clear 
sort year
save usefile, replace

qui use masterfile, clear
merge m:1 year using usefile
sort _merge
drop if _merge<3
drop _merge

qui tsset idj year, yearly 
sort idj year

foreach a of varlist contraction {
qui gen dp7`a'=`a'*dp7
}
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' contraction year dp7contraction dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' contraction year dp7contraction dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.4: alternative cycle indicators
//TFP
sort year
save masterfile, replace

qui use dtfp_2018, clear 
sort year
save usefile, replace

qui use masterfile, clear
merge m:1 year using usefile
sort _merge
drop if _merge<3
drop _merge

qui tsset idj year, yearly 
sort idj year

foreach a of varlist dtfp {
qui gen dp7`a'=`a'*dp7
}
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' dtfp year dp7dtfp dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' dtfp year dp7dtfp dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.6: alternative deflators
//PPI and Regional CPI
*(with dum07) Hourly, real growth, with controls; weighted, n2, full sample; ppi 
foreach a of varlist j_ahr j_cqtotben j_comp { 
//PPI
eststo: capture noisily areg logdiffppi`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiffppi`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
//Regional CPI
eststo: capture noisily areg logdiffcrg`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiffcrg`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.8: alternative errors
//Standard Errors: cluster at n1
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n1)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n1)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Standard Errors: Driscoll-Kraay
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_*, fe  
eststo: capture noisily xtscc logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_*, fe  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table C.10: Composition: Sizes
foreach a of varlist j_ahr j_cqtotben j_comp { 
//pre08
eststo: capture noisily areg logdiff`a' logrgdpdiff gdpsize_* year size_* ft_* femog_* n1_* rg_*  union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff gdpsize_* year size_* ft_* femog_* n1_* rg_*  union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post07
eststo: capture noisily areg logdiff`a' logrgdpdiff gdpsize_* year size_* ft_* femog_* n1_* rg_*  union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff gdpsize_* year size_* ft_* femog_* n1_* rg_*  union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}


//Table 3
*Hourly, real growth, with controls; weighted, n2, full sample; dum07; more controls
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 perct perctsq l.logemplydiff size_* ft_* femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 perct perctsq l.logemplydiff size_* ft_* femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 6
*Private sector only
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if j_ownership==4 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* if j_ownership==4 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 8
*Aymmetry
drop if missing(hplogrgdp) 
qui egen mean_hplogrgdp=mean(hplogrgdp)
qui gen dumblw_meanhprgdp=0
qui replace dumblw_meanhprgdp=1 if hplogrgdp<mean_hplogrgdp
qui gen dumblw_logrgdpdiff=logrgdpdiff*dumblw_meanhprgdp

//before2008
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post2007
eststo: capture noisily areg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post2007: excluding 2008-2009
eststo: capture noisily areg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2009 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dumblw_logrgdpdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2009 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 9
*Aymmetry
foreach a of varlist j_ahr j_cqtotben j_comp { 
//Below-trend periods
eststo: capture noisily areg logdiff`a' logrgdpdiff dp7logrgdpdiff dp7 year femog_* n1_* rg_* union_* own_* if dumblw_meanhprgdp==1 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff dp7logrgdpdiff dp7 year femog_* n1_* rg_* union_* own_* if dumblw_meanhprgdp==1 [pw=wtcon], fe vce(cluster n2)  
//Not-Below-trend periods
eststo: capture noisily areg logdiff`a' logrgdpdiff dp7logrgdpdiff dp7 year femog_* n1_* rg_* union_* own_* if dumblw_meanhprgdp==0 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff dp7logrgdpdiff dp7 year femog_* n1_* rg_* union_* own_* if dumblw_meanhprgdp==0 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table D.13
*Aymmetry: UR changes
qui gen dumblw_urdiff=urdiff*dumblw_meanhprgdp
foreach a of varlist j_ahr j_cqtotben j_comp { 
//pre07
eststo: capture noisily areg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post07
eststo: capture noisily areg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//drop08-09: urdiff
eststo: capture noisily areg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2009 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumblw_urdiff dumblw_meanhprgdp femog_* n1_* rg_* union_* own_* if year>2009 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table D.14
*Aymmetry: UR changes, UR-increase
qui gen dumng=0
qui replace dumng=1 if urdiff>0
qui gen dumng_urdiff=urdiff*dumng

foreach a of varlist dumng {
qui replace dp7`a'=`a'*dp7
}
foreach a of varlist j_ahr j_cqtotben j_comp { 
//pre07
eststo: capture noisily areg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post07
eststo: capture noisily areg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//drop08-09:urdiff+dumng
eststo: capture noisily areg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year>2009 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year dumng_urdiff dumng femog_* n1_* rg_* union_* own_* if year>2009 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table D.15
*Aymmetry: negative RGDP growth
qui replace dumng=0
qui replace dumng=1 if logrgdpdiff<0
qui gen dumng_logrgdpdiff=logrgdpdiff*dumng

foreach a of varlist dumng {
qui gen dp7`a'=`a'*dp7
}

foreach a of varlist j_ahr j_cqtotben j_comp { 
//pre07
eststo: capture noisily areg logdiff`a' logrgdpdiff year dumng_logrgdpdiff femog_* n1_* rg_* union_* own_* if year<=2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dumng_logrgdpdiff femog_* n1_* rg_* union_* own_* if year<=2007 [pw=wtcon], fe vce(cluster n2)  
//post07
eststo: capture noisily areg logdiff`a' logrgdpdiff year dumng_logrgdpdiff femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dumng_logrgdpdiff femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Tables 10 and E.16
*Hourly, real growth, with controls; weighted, n2, full sample; dum07 
foreach a of varlist j_2 j_other j_legal j_disc j_CQBENC01 j_CQBENC02 j_CQBENC03 j_CQBENC04 j_CQBENC05 j_CQBENC06 j_CQBENC07 j_CQBENC10 j_CQBENC11 j_CQBENC12 j_CQBENC13 j_CQBENC14 j_CQBENC15 j_CQBENC16 j_CQBENC19 j_CQBENC20 j_CQBENC21 j_CQBENC23 {
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.5: alternative cycle indicators
//State Employment changes
gen stateyr=j_bls_state_code2*10000+year
sort stateyr
save masterfile, replace

qui use state_emp_2018, clear 
sort stateyr
save usefile, replace

qui use masterfile, clear
merge m:1 stateyr using usefile
sort _merge
drop if _merge==2
drop _merge

qui tsset idj year, yearly 
sort idj year
qui gen logstate_emp=log(state_emp)
qui gen state_empdiff=log(state_emp)-log(l.state_emp)

foreach a of varlist state_empdiff {
qui gen dp7`a'=`a'*dp7
}
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' state_empdiff year dp7state_empdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' state_empdiff year dp7state_empdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.9 additional control: state employment growth
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff state_empdiff femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff state_empdiff femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.5: alternative cycle indicators
//State UR changes
gen stateyr=j_bls_state_code2*10000+year
sort stateyr
save masterfile, replace

qui use state_rg_ur_2018, clear 
sort stateyr
save usefile, replace

qui use masterfile, clear
merge m:1 stateyr using usefile
sort _merge
drop if _merge==2
drop _merge

qui tsset idj year, yearly 
sort idj year
qui gen state_urdiff=state_ur-l.state_ur

foreach a of varlist state_urdiff {
qui gen dp7`a'=`a'*dp7
}

foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' state_urdiff year dp7state_urdiff dp7 femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' state_urdiff year dp7state_urdiff dp7 femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table B.9 additional control: state unemployment rate
foreach a of varlist j_ahr j_cqtotben j_comp { 
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 state_ur femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 state_ur femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 4 
**create new dummy: state_ur above national ur
//Merge state ur dummy
sort j_bls_state_code2
save masterfile, replace

qui use state_ur_dum_2019, clear 
sort j_bls_state_code2
save usefile, replace

qui use masterfile, clear
merge m:1 j_bls_state_code2 using usefile
sort _merge
drop if _merge==2
drop _merge

qui gen dum_stur=0
qui replace dum_stur=1 if state_urdiff>urdiff
foreach a of varlist dum_stur {
qui gen dp7`a'=`a'*dp7
qui gen rgdp`a'=`a'*logrgdpdiff 
qui gen dp7rgdp`a'=`a'*logrgdpdiff*dp7
}

//Table 4: RGDP growth
foreach a of varlist j_ahr j_cqtotben j_comp { 
//new dummy: by state urdiff
eststo: capture noisily areg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 rgdpdum_stur dp7rgdpdum_stur dum_stur dp7dum_stur femog_* n1_* rg_* union_* own_* [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year dp7logrgdpdiff dp7 rgdpdum_stur dp7rgdpdum_stur dum_stur dp7dum_stur femog_* n1_* rg_* union_* own_* [pw=wtcon], fe vce(cluster n2)  
esttab, se ar2 stats(N r2)
estimates clear
}

//Table 5: RGDP growth, post07 only
foreach a of varlist dstur1 dstur2 dstur3 {
qui gen rgdp_`a'=`a'*logrgdpdiff
}

foreach a of varlist j_ahr j_cqtotben j_comp { 
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with national urdiff
eststo: capture noisily areg logdiff`a' logrgdpdiff year rgdp_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year rgdp_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with state_urdiff median
eststo: capture noisily areg logdiff`a' logrgdpdiff year rgdp_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year rgdp_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, top quantile
eststo: capture noisily areg logdiff`a' logrgdpdiff year rgdp_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' logrgdpdiff year rgdp_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  

esttab, se ar2 stats(N r2)
estimates clear
}

//Table C.11: National UR changes, post07 only
foreach a of varlist dstur1 dstur2 dstur3 {
qui gen ur_`a'=`a'*urdiff
}

foreach a of varlist j_ahr j_cqtotben j_comp { 
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with national urdiff
eststo: capture noisily areg logdiff`a' urdiff year ur_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year ur_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with state_urdiff median
eststo: capture noisily areg logdiff`a' urdiff year ur_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year ur_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, top quantile
eststo: capture noisily areg logdiff`a' urdiff year ur_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' urdiff year ur_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  

esttab, se ar2 stats(N r2)
estimates clear
}

//Table C.12: State UR changes, post07 only
foreach a of varlist dstur1 dstur2 dstur3 {
qui gen stur_`a'=`a'*state_urdiff
}

foreach a of varlist j_ahr j_cqtotben j_comp {
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with national urdiff
eststo: capture noisily areg logdiff`a' state_urdiff year stur_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' state_urdiff year stur_dstur1 dstur1 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, compared with state_urdiff median
eststo: capture noisily areg logdiff`a' state_urdiff year stur_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' state_urdiff year stur_dstur2 dstur2 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  
//post07 only: dummy for urdiff 2008Mar-2010Mar, top quantile
eststo: capture noisily areg logdiff`a' state_urdiff year stur_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=j_estoccwt], absorb(idj) vce(cluster n2)  
eststo: capture noisily xtreg logdiff`a' state_urdiff year stur_dstur3 dstur3 femog_* n1_* rg_* union_* own_* if year>2007 [pw=wtcon], fe vce(cluster n2)  

esttab, se ar2 stats(N r2)
estimates clear
}

